package org.infinitest.intellij;

import org.junit.Test;
import org.infinitest.TestEvent;
import org.jmock.Expectations;
import org.jmock.Mockery;

@SuppressWarnings({"ThrowableInstanceNeverThrown"})
public class WhenTestPasses {
    private InfinitestAnnotator annotator;
    private Mockery mockery = new Mockery();

    @Test
    public void shouldClearAnnotation() {
        final TestEvent event = new TestEvent(TestEvent.TestState.METHOD_SUCCESS, "message", "test", "method",
            new Exception());

        annotator = mockery.mock(InfinitestAnnotator.class);
        mockery.checking(new Expectations() {
            {
                one(annotator).clearAnnotation(event);
            }
        });

        new InfinitestTestStatusListener(annotator).testMethodSucceeded(event);

        mockery.assertIsSatisfied();
    }
}
